import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllHomepageStores = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        homepageStoresLoading: false,
        homepageStores: [],
    });

    const loadAllHomepageStores = async () => {
        state.homepageStoresLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let homepageStores = res?.a?.nodes || [];
        let homepageStores = [0, 1, 3, 3, 3, 3, 3]
        state.homepageStores = homepageStores;
        state.homepageStoresLoading = false;
        // return homepageStores;
    };

    return { ...state, loadAllHomepageStores };
};

const query = compress(``);

export default useAllHomepageStores;
